The blockchain is the underlying technology of bitcoin system. Bitcoin is the first cryptographic-based electronic money, which was invented in 2008. Bitcoin is a decentralized peer-to-peer transaction network for recording and verifying the bitcoin transactions. The units that record and verify the bitcoin transactions are called miners. The miners maintain ledgers of all transaction in the blockchain.
In this document the term “blockchain” to include all forms of electronic, computer-based, distributed ledgers. These include consensus-based blockchain, mining-based technologies, permissioned and un-permissioned ledgers, side chain and alt chain technologies, shared ledgers and variations thereof. The most widely known application of blockchain technology is the bitcoin ledger, although many other blockchain implementations are developed. While bitcoin may be referred to herein for the purpose of convenience and illustration, it should be noted that the disclosure is not limited to use with the bitcoin blockchain and alternative blockchain implementations and protocols fall within the scope of the present disclosure.
A blockchain is implemented in a computer-based decentralized, distributed system made up of blocks which in turn are made up of transactions. Each transaction is a data structure that encodes the transfer of control of digital assets between participants in the blockchain system. It includes at least one input and at least one output. Each block contains a hash of the previous block to that blocks become chained together to create a permanent, unalterable record of all transactions which have been written to the blockchain since its inception.
Typical transaction output looks like below, wherein “Input” represents the person who has spent, by signing (as in scriptSig). The “Output” represents the person who has received, in this case the owner of scriptPubKey (ie. The bitcoin address of receiver)
Input:Previous tx: f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6Index: 0scriptSig:304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d1090db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501Output:Value: 5000000000scriptPubKey: OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549dOP_EQUALVERIFY OP_CHECKSIG
The small programs in transactions (like scriptPubKey) known as scripts embedded into their inputs and outputs specify how and by whom the outputs of the transactions can be accessed.
On the bitcoin platform, these scripts are written using a stack-based scripting language. In order for a transaction to be written to the blockchain, it must be ‘validated’. Network nodes (miners) perform work to ensure that each transaction is valid, with invalid transactions being rejected by the network.
Typically in bitcoin blockchain technology the transacting entity which can be called a user, is identified by a public-key or a user having a secret. In the case of transacting entity identified by public-key, it is called P2PKH method, The other method of the user having a secret is called the P2SH method.
In the P2PKH method, the holder of the public-key needs to provide public-key and signature to withdraw from blockchain address. This is then validated by the miner or consensus provider. The miners verify the user by checking the hash of public-key user has provided and also the signature of the public-key holder. This method of checking is called P2PKH method (pay-to-public-key-hash) in bitcoin system.
In the P2PKH method, the public-key, private-key is created from Elliptic Curve Digital Signature Algorithm (ECDSA).
In the P2SH method, the users are identified by, the user having redeem-script and also having input for redeem-script. In this method, the bitcoin users will provide the redeem-script-input and redeem-script to spend the bitcoin. In this method, the miners will verify if the hash of the redeem-script matches with the hash stored in bitcoin address. Then it processes the redeem-script-input following the redeem-script. This method of checking is called P2SH (pay-to-script-hash) in bitcoin system.
In the P2SH and P2PKH method, the scripts use bitcoin Opcodes, these Opcodes are bitcoin instructions like OP_IF, OP_DUP etc. These Opcodes instruct the miners, how the data has to be processed.
The P2SH and P2PKH scripts are considered standard-scripts in bitcoin system.
To provide custom features, developers use custom Opcodes to achieve the custom outcome. Such scripts are considered non-standard-scripts. They are also called bitcoin custom-contracts or bitcoin smart contracts.
The bitcoin custom-contracts, typically use P2SH method, where the redeem-script has the custom-contract. The custom-contract may contain non-standard Opcodes. When the redeem-script has non-standard Opcodes, the bitcoin miners may refuse to mine the non-standard Opcodes as it is expensive and risky to avoid bugs in custom-contracts.
Because of this, there is less support to bitcoin custom-contracts by miners. Hence the bitcoin custom-contracts are not very popular.
In the P2SH method, the popular redeem-scripts are P2PKH script and multi-signature script. When P2PKH script is used as redeem-script, the spender will provide the signature and his public-key to spend. When the multi-signature script is used as redeem-script, spender will provide signatures of multi-signature participants.
Typical P2SH uses following pattern    scriptPubKey: OP_HASH160<scriptHash>OP_EQUAL    scriptSig: <input to script><serialized script>    where <input to script> is input to serialized script.
Typical P2PKH uses following pattern    scriptPubKey: OP_DUP OP_HASH160<pubKeyHash>OP_EQUALVERIFY    OP_CHECKSIG    scriptSig: <sig><pubKey>
Typical Multi-signature uses following pattern    scriptPubKey: OP_HASH160<scriptHash>OP_EQUAL    scriptSig: . . . signatures . . . <serialized script>    m-of-n multi-signature transaction:    scriptSig: 0<sig1> . . . <script>    script: OP_m<pubKey1> . . . OP_n OP_CHECKMULTISIG
To overcome limitation of bitcoin custom-contracts, other blockchain solutions evolved. The popular alternatives are Ethereum and Hyperledger. In these systems, the custom-contract scripts are written in high level languages like Solidity, Go, Java. These are then installed in blockchain. These are then executed by users to get desired results.
The present disclosure is an improvement to standard usage of P2SH redeem-script mechanism, due to which dependency of signature for every transaction is removed. Instead of that, a UID-key is used to identify the blockchain device and a secret (like a PIN) delivered by SMS on mobile or similar methods can be used to perform the transaction. Thus resulting in the easier creation of bitcoin custom-contracts. Where ever bitcoin custom-contracts are used they can be decoupled from the dependency signature in some situations to perform the transaction.
This should help more acceptance of bitcoin custom-contracts in applications to control blockchain-devices.
Another prevalent method is the use of OP_RETURN based solutions. In this method, they use OP_RETURN to implement solutions. By using OP_RETURN mechanism 40 bytes of data is stored in the blockchain. This 40 byte is used intelligently to implement some solutions like asset-management, document-signing, document-verification. However, this method of bitcoin solutions solves different problems. So it is not related to present disclosure. The OP_RETURN based implementation is used in colored coins, and multichain.
The present disclosure can also be called the script-less script as it achieves functionalities that typically requires complex scripts without actually using complex scripts.
U.S. Pat. No. 4,995,082 describes efficient short signatures generation mechanism. This is popularly called shnorr technique. It is described in some articles on script-less scripts in bitcoin. This mechanism is different and used for solving different problems.
US patent application WO2017187395A1 describes a system for controlling the performance of a contract using a distributed hash table and a peer-to-peer distributed ledger. This uses regular way of using P2SH to ensure license is controlled through blockchain.
US patent application WO2017187396A1 shows a mechanism for implementing logic gates using blockchain. However, this uses the traditional way of using P2SH. The present disclosure uses different mechanism compared to this prior art.
US patent application US 2016/0283920 A1 stores hash of evidence in the blockchain. This is used for detecting tampering. This is solving a different problem. The disclosed method is different from this method.
U.S. Pat. No. 9,849,364 B2 uses ethereum blockchain to control devices. Using disclosed methods similar control can be achieved using bitcoin blockchain.
US patent application 2016/0283941 A1 describes a mechanism for using P2SH for personal identification and verification. The disclosed method is different from this method.
Briefly, the following problems are not easily implementable using existing bitcoin standard-scripts usage mechanisms:                Multi-user approvals, using traditional login/password or one-time passwords.        Remote locking/unlocking devices through blockchain.        Location-based triggering of activities through blockchain.        Multi-user document signing, using traditional login, OTP.        Easily redeemable coupons issued on the blockchain.        
The feasibility of disclosed methods has been tested using bitcoinjs-lib library version 2.3. The confirmation of working feasibility is done in a debug environment. The screenshots and examples are provided. However, these examples depend on other environments needed to execute them.
The examples provided are for demonstration of few methods. However, its usage is not limited to only those methods.
Below is some privacy-related observation of P2SH.
In the P2SH method, the input to redeem-script is private until the transaction is executed. However, after the transaction is executed it is visible in the raw data of the transaction to the public. This prevents multiple transactions happening between two users in blockchain using the disclosed method. This is a limitation of this method.
To allow for multiple transactions between two users, overcoming above limitation, a method of coupling controlling-system and blockchain-device is provided.
To allow same blockchain address to be used multiple times a method is provided to build dependency signature for blockchain transaction with disclosed methods.
Also to prevent exposure of data in public records, the hash of control-codes can be used in redeem-script-input.